import { Component } from '@angular/core';
import { _HttpClient } from '@delon/theme';
import { SimpleGeneralcListComponent } from '../dynamic/list/general.list.component';

@Component({
  selector: 'app-simple-list',
  templateUrl: '../dynamic/list/general.list.component.html',
})
export class SimpleListComponent extends SimpleGeneralcListComponent {
  getCode() {
    return 'simple_list';
  }

  add() {
    this.router.navigate(['/simple/list/edit'], { queryParams: { code: '' } });
  }

  edit(record: any) {
    if (!record) {
      if (this.selectedRows.length != 1) {
        this.msgSrv.error('请选择一行数据！');
      } else {
        record = this.selectedRows[0];
      }
    }
    this.router.navigate(['/simple/list/edit'], { queryParams: { code: record.code } });
  }
}
